#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QStatusBar>
#include <QString>
#include <QLabel>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //状态栏临时消息
//    QStatusBar* statu = this->statusBar();
//    this->setStatusBar(statu);
       QString info = "服务器消息:[用户:已上线!]";
//    statu->showMessage(info,2000);
    //状态栏永久消息--通过标签实现
    QStatusBar* stauBar = this->statusBar();
    this->setStatusBar(stauBar);
    QLabel* label = new QLabel(this);
    stauBar->addWidget(label);
    label->setText(info);
}

MainWindow::~MainWindow()
{
    delete ui;
}

